class_name  子弹

extends Node2D
var speed=600
var direction:Vector2
@onready var 子弹超时销毁=$Timer/Timer
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
	global_position+=speed*direction*_delta
	#碰墙.
	pass


func _on_hit_box_hit(equl_name) -> void:
	if equl_name=="player_hurtBox" or equl_name=="bullet_hitBox":
		return
	#queue_free()
	
func 获取发射方向(_direction:Vector2):
	self.direction=_direction


func _on_timer_timeout() -> void:
	if not multiplayer.is_server():
		queue_free()
	


func _on_bullet_hit_box_body_entered(body: Node2D) -> void:
	if body.is_in_group("墙"):
		print(body)
	pass # Replace with function body.


func _on_timer_timeout超时() -> void:
	queue_free()
	pass # Replace with function body.
